package mul.Logic;

import java.util.TimerTask;

public class CountdownTimer extends TimerTask {
	
	private GameState gs;
	private int maxtime= 3;
	private int timeleft = maxtime;
	
	public CountdownTimer(GameState gs) {
		this.gs = gs;
	}
	
	public void run() {
		if(timeleft > 0)
			timeleft--;
		
		gs.setLevelCountdownValue(timeleft);
		
		if(timeleft == 0) {
			gs.setLevelCountdown(false);
			gs.startSpawnTimer();
			this.cancel();
			gs.setIsNewLevel(false);
		}
	}
	
}
